local table_name = "online_log"
local insert_sql = "INSERT INTO `%s` (`update_time`, `user_online`, `temp_online`, `user_loading`) VALUES ('%s', '%s', '%s', '%s');"

local M = {}

function M.write(conn, msg)
    local user_online, temp_online, user_loading = table.unpack(msg.data)
    local cmd = string.format(insert_sql, table_name, os.date("%Y-%m-%d %H:%M:%S"), user_online, temp_online, user_loading)
    -- print(cmd)
    conn:execute(cmd)
end

return M
